home *** CD-ROM | disk | FTP | other *** search
/ APDL Other Worlds / APDL Other Worlds Collection.iso / SF3000 / Extras / !SFcolours / c / SFCFileInfo < prev    next >
Encoding:
Text File  |  2003-10-24  |  2.6 KB  |  79 lines

  1. /*
  2.  *  SFcolours - Star Fighter 3000 colours editor
  3.  *  File info window
  4.  *  Copyright (C) 2001  Chris Bazley
  5.  *
  6.  *  This program is free software; you can redistribute it and/or modify
  7.  *  it under the terms of the GNU General Public Licence as published by
  8.  *  the Free Software Foundation; either version 2 of the Licence, or
  9.  *  (at your option) any later version.
  10.  *
  11.  *  This program is distributed in the hope that it will be useful,
  12.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *  GNU General Public Licence for more details.
  15.  *
  16.  *  You should have received a copy of the GNU General Public Licence
  17.  *  along with this program; if not, write to the Free Software
  18.  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /* ANSI library files */
  22. #include <stdlib.h>
  23. #include <stdio.h>
  24. #include <string.h>
  25.  
  26. /* RISC OS library files */
  27. #include "wimp.h"
  28. #include "toolbox.h"
  29. #include "event.h"
  30. #include "wimplib.h"
  31. #include "fileinfo.h"
  32.  
  33. /* My library files */
  34. #include "err.h"
  35. #include "msgtrans.h"
  36. #include "Macros.h"
  37.  
  38. /* Local headers */
  39. #include "EditColmap.h"
  40. #include "SFCFileInfo.h"
  41.  
  42. ObjectId fileinfo_sharedid = NULL_ObjectId;
  43.  
  44. /* ----------------------------------------------------------------------- */
  45. /*                       Function prototypes                               */
  46.  
  47. static ToolboxEventHandler _FileInfo_abouttoopen;
  48.  
  49. /* ----------------------------------------------------------------------- */
  50. /*                         Public functions                                */
  51.  
  52. void FileInfo_initialise(IdBlock *id_block)
  53. {
  54.   fileinfo_sharedid = id_block->self_id;
  55.  
  56.   /* file type is constant */
  57.   EF(fileinfo_set_file_type(0, fileinfo_sharedid, FILETYPE_FEDNET));
  58.  
  59.   EF(event_register_toolbox_handler(fileinfo_sharedid, FileInfo_AboutToBeShown, _FileInfo_abouttoopen, NULL));
  60. }
  61.  
  62. /* ----------------------------------------------------------------------- */
  63. /*                         Private functions                               */
  64.  
  65. static int _FileInfo_abouttoopen(int event_code, ToolboxEvent *event, IdBlock *id_block, void *handle)
  66. {
  67.   ViewData *view_data;
  68.  
  69.   E_RETV(toolbox_get_client_handle(0, id_block->ancestor_id, (void **)&view_data), 1)
  70.  
  71.   /* Set up contents */
  72.   RE(fileinfo_set_file_size(0, fileinfo_sharedid, view_data->start_editnum + view_data->num_cols))
  73.   RE(fileinfo_set_modified(0, id_block->self_id, view_data->changed_since_save))
  74.   RE(fileinfo_set_file_name(0, id_block->self_id, view_data->last_savepath))
  75.   RE(fileinfo_set_date(0, id_block->self_id, view_data->file_date))
  76.  
  77.   return 1; /* claim event */
  78. }
  79.